/***************************************************************************
 *   Salatinoid - Islamic Prayer Time Plasmoid                             *
 *   Copyright (C) 2009 by Tarek Saidi  <tarek.saidi@arcor.de>             *
 *                                                                         *
 *   Bismillah ar-Rahman ar-Rahim;                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation, either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program. If not, see <http://www.gnu.org/licenses/>.  *
 ***************************************************************************/

#ifndef PLASMA_APPLET_SALATINOID_HEADER
#define PLASMA_APPLET_SALATINOID_HEADER

#include <QApplication>
#include <QPainter>
#include <QFontMetrics>
#include <QSizeF>
#include <QString>
#include <QPixmap>
#include <QTime>
#include <QTimer>
#include <QPen>
#include <QFont>
#include <QStringList>
#include <QGraphicsGridLayout>
#include <QGraphicsTextItem>

#include <QLineEdit>
#include <KIcon>
#include <KConfigDialog>
#include <KComponentData>
#include <KNotifyConfigWidget>
#include <KGlobalSettings>
#include <KConfigDialogManager>
#include <KNotification>
#include <KStandardDirs>
#include <KLocale>

#include <Plasma/Applet>
#include <Plasma/DataEngine>
#include <Plasma/Theme>
#include "ui_config_widget_general.h"

#include "graphicstextwidget.h"


class Salatinoid : public Plasma::Applet
{
    Q_OBJECT
    public:
        Salatinoid(QObject *parent, const QVariantList &args);
        ~Salatinoid();
	void init();
        void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option,  const QRect& contentsRect);
        void applyParameters();
	void updateMessages();
    public slots:
	void showConfigurationInterface(); 
        void dataUpdated(const QString&, const Plasma::DataEngine::Data &);
        void test_incrementTime();
    protected slots:
        void updateConfiguration();
    private:
        QString formatPrayerHour(const QTime &) const;
        QString timeLeftString(const QDateTime&) const;

        QDateTime now;
        QGraphicsGridLayout* graphicsLayout;
        KIcon *icon;
        QPixmap *background;
        QFont prayerLabelFont;
        QFont limitLabelFont;
        QFont prayerTimeFont;
        QFont timeLeftFont;

        GraphicsTextWidget* nameLabels[7];
        GraphicsTextWidget* timeLabels[7];
        GraphicsTextWidget* timeLeftLabel;
        int timeLeftLabelIndex;
        QString prayerNames[7];
        QString prayerTimeTexts[7];
        QString timeLeftText;
        QString beginsInText;
        QString endsInText;

        QDateTime prayerTimes[8];
        int currentPrayer;
        int nextPrayer;

        Ui_SalatinoidConfigDialog ui_configDlg;
        KConfigDialog *configDlg;

        QTimer test_timer;
};




#endif
